/**
 * Created by TRwin7SP1 on 2016/8/15.
 */
angular.module('inspinia')
  .controller('ContouringController',function ($scope,$log) {
    $scope.treeConfig1 = {
      'plugins' : [ 'types','checkbox' ],
      'types' : {
        'default' : {
          'icon' : 'fa fa-folder'
        },
        'user' : {
          'icon' : 'fa fa-user'
        },
        'book' : {
          'icon' : 'fa fa-book'
        },
        'css' : {
          'icon' : 'fa fa-file-code-o'
        },
        'img' : {
          'icon' : 'fa fa-file-image-o'
        },
        'js' : {
          'icon' : 'fa fa-file-text-o'
        }

      }
    };
    $scope.treeData1 = [
      {
        "id": "paitient",
        "parent": "#",
        "text": "Patient:222646_268595",
        "state": {
          "opened": true
        },
        "type": "user",
        "__uiNodeId": 1
      }, {
        "id": "study",
        "parent": "paitient",
        "text": "Study :4935",
        "state": {
          "opened": true
        },
        "__uiNodeId": 2
      }, {
        "id": "series",
        "parent": "study",
        "text": "Series:Series 2",
        "state": {
          "opened": true
        },
        "type": "book",
        "__uiNodeId": 3
      },
      {
        "id": "image",
        "parent": "series",
        "text": "image:UCC",
        "state": {
          "opened": true
        },
        "type": "css",
        "__uiNodeId": 4
      },



      {
        "id": "course",
        "parent": "paitient",
        "text": "Course: C1",
        "state": {
          "opened": true
        },
        "__uiNodeId": 5
      },
      {
        "id": "plan",
        "parent": "course",
        "text": "Plan 2# plan1",
        "state": {
          "opened": true
        },
        "type": "css",
        "__uiNodeId": 6
      },



    ];

    $scope.treeConfig = {


      core : {
        multiple : true,
        animation: false,
        error : function(error) {
          $log.error('treeCtrl: error from js tree - ' + angular.toJson(error));
        },
        check_callback : true,
        worker : true
      },


      'plugins' : [ 'types', 'dnd','checkbox' ],
      'types' : {
        'default' : {
          'icon' : 'fa fa-folder'
        },
        'html' : {
          'icon' : 'fa fa-file-code-o'
        },
        'svg' : {
          'icon' : 'fa fa-file-picture-o'
        },
        'css' : {
          'icon' : 'fa fa-file-code-o'
        },
        'img' : {
          'icon' : 'fa fa-file-image-o'
        },
        'js' : {
          'icon' : 'fa fa-file-text-o'
        }

      }
    };

    $scope.treeData = [
      {
        "id": "ajson1",
        "parent": "#",
        "text": "Admin theme",
        "state": {
          "opened": true
        },
        "__uiNodeId": 1
      }, {
        "id": "ajson2",
        "parent": "ajson1",
        "text": "css",
        "state": {
          "opened": true
        },
        "__uiNodeId": 2
      }, {
        "id": "ajson3",
        "parent": "ajson2",
        "text": "animate.css",
        "state": {
          "opened": true
        },
        "type": "css",
        "__uiNodeId": 3
      },
      {
        "id": "ajson4",
        "parent": "ajson2",
        "text": "bootstrap.css",
        "state": {
          "opened": true
        },
        "type": "css",
        "__uiNodeId": 4
      },
      {
        "id": "ajson5",
        "parent": "ajson2",
        "text": "style.css",
        "state": {
          "opened": true
        },
        "type": "css",
        "__uiNodeId": 5
      },
      {
        "id": "ajson6",
        "parent": "ajson1",
        "text": "fonts",
        "state": {
          "opened": false
        },
        "__uiNodeId": 6
      },
      {
        "id": "ajson9",
        "parent": "ajson6",
        "text": "glyphicons-halflings-regular.eot",
        "state": {
          "opened": true
        },
        "type":"img",
        "__uiNodeId": 9
      },
      {
        "id": "ajson10",
        "parent": "ajson6",
        "text": "glyphicons-halflings-regular.svg",
        "state": {
          "opened": true
        },
        "type":"svg",
        "__uiNodeId": 10
      },
      {
        "id": "ajson11",
        "parent": "ajson6",
        "text": "glyphicons-halflings-regular.ttf",
        "state": {
          "opened": true
        },
        "type":"img",
        "__uiNodeId": 11
      },
      {
        "id": "ajson12",
        "parent": "ajson6",
        "text": "glyphicons-halflings-regular.woff",
        "state": {
          "opened": true
        },
        "type":"img",
        "__uiNodeId": 12
      },
      {
        "id": "ajson7",
        "parent": "ajson1",
        "text": "img",
        "state": {
          "opened": true
        },
        "__uiNodeId": 7
      },
      {
        "id": "ajson13",
        "parent": "ajson7",
        "text": "profile_small.jpg",
        "state": {
          "opened": true
        },
        "type": "img",
        "__uiNodeId": 13
      },
      {
        "id": "ajson14",
        "parent": "ajson7",
        "text": "angular_logo.png",
        "state": {
          "opened": true
        },
        "type": "img",
        "__uiNodeId": 14
      },
      {
        "id": "ajson15",
        "parent": "ajson7",
        "text": "html_logo.png",
        "state": {
          "opened": true
        },
        "li_attr": {"class": "text-navy"},
        "type": "img",
        "__uiNodeId": 15
      },
      {
        "id": "ajson16",
        "parent": "ajson7",
        "text": "mvc_logo.png",
        "state": {
          "opened": true
        },
        "li_attr": {"class": "text-navy"},
        "type": "img",
        "__uiNodeId": 16
      },
      {
        "id": "ajson8",
        "parent": "ajson1",
        "text": "js",
        "state": {
          "opened": true
        },
        "__uiNodeId": 8
      },
      {
        "id": "ajson17",
        "parent": "ajson8",
        "text": "inspinia.js",
        "state": {
          "opened": true
        },
        "type":"js",
        "__uiNodeId": 17
      },
      {
        "id": "ajson18",
        "parent": "ajson8",
        "text": "bootstrap.js",
        "state": {
          "opened": true
        },
        "type":"js",
        "__uiNodeId": 18
      },
      {
        "id": "ajson19",
        "parent": "ajson8",
        "text": "jquery-2.1.1.js",
        "state": {
          "opened": true
        },
        "type":"js",
        "__uiNodeId": 19
      },
      {
        "id": "ajson20",
        "parent": "ajson8",
        "text": "jquery-ui.custom.min.js",
        "state": {
          "opened": true
        },
        "type":"js",
        "__uiNodeId":20
      },
      {
        "id": "ajson21",
        "parent": "ajson1",
        "text": "affix.html",
        "type":"html",
        "__uiNodeId":21
      },
      {
        "id": "ajson22",
        "parent": "ajson1",
        "text": "dashboard.html",
        "type":"html",
        "__uiNodeId":22
      },
      {
        "id": "ajson23",
        "parent": "ajson1",
        "text": "buttons.html",
        "type":"html",
        "__uiNodeId":23
      },
      {
        "id": "ajson24",
        "parent": "ajson1",
        "text": "calendar.html",
        "type":"html",
        "__uiNodeId":24
      },
      {
        "id": "ajson25",
        "parent": "ajson1",
        "text": "contacts.html",
        "type":"html",
        "__uiNodeId":25
      },
      {
        "id": "ajson26",
        "parent": "ajson1",
        "text": "css_animation.html",
        "type":"html",
        "__uiNodeId":26
      },
      {
        "id": "ajson27",
        "parent": "ajson1",
        "text": "flot_chart.html",
        "type":"html",
        "__uiNodeId":27
      },
      {
        "id": "ajson28",
        "parent": "ajson1",
        "text": "google_maps.html",
        "type":"html",
        "__uiNodeId":28
      },
      {
        "id": "ajson29",
        "parent": "ajson1",
        "text": "icons.html",
        "type":"html",
        "__uiNodeId":29
      },
      {
        "id": "ajson30",
        "parent": "ajson1",
        "text": "invoice.html",
        "type":"html",
        "__uiNodeId":30
      },
      {
        "id": "ajson31",
        "parent": "ajson1",
        "text": "login.html",
        "type":"html",
        "__uiNodeId":31
      }
    ];


    $('#jstree_demo_div').on("changed.jstree", function (e, data) {
      console.log(data);
    });




    $scope.readyCB = function() {
      $log.info('ready called');
    };

    $scope.createNodeCB = function(e,item) {
      $log.info('create_node called');
    };











    $scope.treeEventsObj = {
      'ready': readyCB,
      'create_node': createNodeCB
    }

    function readyCB() {
      $log.info('ready called');
    };

    function createNodeCB(e,item) {
      $log.info('create_node called');
    };



    // var selected_nodes = $scope.treeInstance.jstree(true).get_selected();





    /**
     * Data for Line chart
     */
    $scope.lineData = {
      labels: ["January", "February", "March", "April", "May", "June", "July"],
      datasets: [
        {
          label: "Example dataset",
          fillColor: "rgba(220,220,220,0.5)",
          strokeColor: "rgba(220,220,220,1)",
          pointColor: "rgba(220,220,220,1)",
          pointStrokeColor: "#fff",
          pointHighlightFill: "#fff",
          pointHighlightStroke: "rgba(220,220,220,1)",
          data: [65, 59, 80, 81, 56, 55, 40]
        },
        {
          label: "Example dataset",
          fillColor: "rgba(26,179,148,0.5)",
          strokeColor: "rgba(26,179,148,0.7)",
          pointColor: "rgba(26,179,148,1)",
          pointStrokeColor: "#fff",
          pointHighlightFill: "#fff",
          pointHighlightStroke: "rgba(26,179,148,1)",
          data: [28, 48, 40, 19, 86, 27, 90]
        }
      ]
    };

    /**
     * Options for Line chart
     */
    $scope.lineOptions = {
      scaleShowGridLines : true,
      scaleGridLineColor : "rgba(0,0,0,.05)",
      scaleGridLineWidth : 1,
      bezierCurve : true,
      bezierCurveTension : 0.4,
      pointDot : true,
      pointDotRadius : 4,
      pointDotStrokeWidth : 1,
      pointHitDetectionRadius : 20,
      datasetStroke : true,
      datasetStrokeWidth : 2,
      datasetFill : true
    };


  });
